package com.armail.server.rs;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import com.armail.server.dao.UserDAO;
import com.armail.server.dao.impl.UserDAOImpl;
import com.armail.server.domain.User;

@Path("users")
public class UserResource {
	
	UserDAO userDAO = UserDAOImpl.getInstance();
	
	@Path("/findByUserName/{userName}")
    @GET
    @Produces(MediaType.APPLICATION_XML)
	public User findByUsername(@PathParam("userName") String userName) {
		return userDAO.findByUsername(userName);
	}
	
	@Path("/create")
	@POST
	public User createUser(User user) {
		return userDAO.create(user);
	}
}